package classes;

import java.util.ArrayList;

public class User {
	int userID;
	String username;
	String name;
	String surname;
	String password;
	String status;
	String info;
	String question;
	String answer;
	String pic;
	ArrayList<Integer> subjectsLeqtor;
	ArrayList<Group> subjectsStudent;
	ArrayList<String> subjectsSectionLeader;
	

	public User(int userID, String username, String name, String surname, String password,
				String status, String info, String question, String answer, String pic,
				ArrayList<Integer> subjectsLeqtor, ArrayList<Group> subjectsStudent,
				ArrayList<String> subjectsSectionLeader) {
		this.userID = userID;
		this.username = username;
		this.name = name;
		this.surname = surname;
		this.password = password;
		this.status = status;
		this.info = info;
		this.question = question;
		this.answer = answer;
		this.pic = pic;
		this.subjectsLeqtor = subjectsLeqtor;
		this.subjectsSectionLeader = subjectsSectionLeader;
		this.subjectsStudent = subjectsStudent;	
	}

	
	public int getUserId(){
		return userID;
	}
	
	/**
	 * returns username of this object
	 */
	public String getUserName() {
		return username;
	}
	
	public void setUserName(String username) {//TODO:
		if(this.username.equals(username)) return;
		AccountManager.updateSomething(this.username, "username", username);
		this.username = username;
	}
	
	

	public String getName() {
		return name;
	}
	
	public void setName(String name){
		AccountManager.updateSomething(username, "name", name);
		this.name = name;
	}
	

	public String getSurName() {
		return surname;
	}
	
	public void setSurName(String surname){
		AccountManager.updateSomething(username, "surname", surname);
		this.surname = surname;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		AccountManager.updateSomething(username, "password", password);
		this.password = password;
	}
	
	public String getStatus() {
		return status;
	}

	

	public void setStatus(String status) {
		AccountManager.updateSomething(username, "status", status);
		this.status = status;
	}

	public String getQuestion() {
		return question;
	}

	public void setQuestion(String question) {
		AccountManager.updateSomething(username, "question", question);
		this.question = question;
	}

	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		AccountManager.updateSomething(username, "answer", answer);
		this.answer = answer;
	}

	public String getInfo() {
		return info;
	}

	public void setInfo(String info) {
		AccountManager.updateSomething(username, "info", info);
		this.info = info;
	}

	
	public String getPic(){
		return pic;
	}
	
	public void setPic(String pic){
		AccountManager.updateSomething(username, "pic", pic);
		this.pic = pic;
	}
	
	public ArrayList<Integer> getSubjectsLector(){
		return subjectsLeqtor;
	}
	
	public void addSubjectToLector(Integer subjectName){
		subjectsLeqtor.add(subjectName);
	}
	
	
	public ArrayList<Group> getSubjectsStudent(){
		return subjectsStudent;
	}
	
	public void addSubjectToStudent(Group subjectName){
		subjectsStudent.add(subjectName);
	}
	
	
	public ArrayList<String> getSubjectsSectionLeader(){
		return subjectsSectionLeader;
	}
	
	public void addSubjectToSectionLeader(String subjectName){
		subjectsSectionLeader.add(subjectName);
	}	
	
	@Override
	public String toString() {
		return "username = " + getUserName() + " name = " + getName() + " surname = " + getSurName() + " password = " 
				+ getPassword() + " status = " + getStatus() + " info = " + getInfo() + " question = " + getQuestion()
				+ " answer = " + getAnswer() + " pic = " + getPic();
	}
}
